<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class timeline extends CI_Controller {

	public function index()
	{		
		$all_session = $this->session->all_userdata();
		@$uri = $all_session['login'][0]['mem_id'];
		$data['member'] = $this->pmember_model->profile($uri);

		$data['timeline'] = $this->timeline_model->get_timeline();

		$data['get_year'] = $this->timeline_model->get_year();

		if($_POST)
		{
			$session['year'] = $this->input->post('year');	
			$this->session->set_userdata($session);
		} else {
			date_default_timezone_set("Asia/Bangkok");
			$session['year'] = date("Y");
			$this->session->set_userdata($session);
		}

		$this->load->view('timeline',$data);
	}

	public function event()
	{
		$all_session = $this->session->all_userdata();
		@$uri = $all_session['login'][0]['mem_id'];
		$data['member'] = $this->pmember_model->profile($uri);

		$seg_5 = urldecode($this->uri->segment(5));

		$input = array(
			'year' => $this->uri->segment(3),
			'month' => $this->uri->segment(4),
			'event_name' => $seg_5
		);
	
		$data['search'] = $this->timeline_model->get_event($input);	
		$this->load->view('timeline_search' ,$data);

	}

	
}